﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FPSO.HMI.Controls
{
    /// <summary>
    /// UCDateView.xaml 的交互逻辑
    /// </summary>
    public partial class UCDateView : UserControl
    {
        public UCDateView()
        {
            InitializeComponent();
            btnDate0.Content = DateTime.Now.ToString("yyyy-MM-dd");
            btnDate1.Content = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            btnDate2.Content = DateTime.Now.AddDays(2).ToString("yyyy-MM-dd");
        }

        public Action<string> DateClick;

        private void iBtnClose_Click(object sender, MouseButtonEventArgs e)
        {
            OnDateClick(string.Empty);
        }

        protected void OnDateClick(string dateStr)
        {
            if (DateClick != null)
            {
                DateClick(dateStr);
            }
        }

        private void btnDate_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;
            OnDateClick(btn.Content.ToString());
        }
    }
}
